package edu.zqu.course.project.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import edu.zqu.course.project.domain.pojo.Course;
import edu.zqu.course.project.mapper.CourseMapper;
import edu.zqu.course.project.service.CourseService;
import edu.zqu.course.response.CourseNumAndName;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 * 课程 服务实现类
 * </p>
 *
 * @author 郭泽鹏
 * @since 2020-06-24
 */
@Service
public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> implements CourseService {
    @Resource
    CourseMapper courseMapper;

    @Override
    public CourseNumAndName getCourseNumAndName(String id) {
        Course course = courseMapper.selectById(id);
        CourseNumAndName courseNumAndName = new CourseNumAndName(course.getNumber(), course.getName());
        return courseNumAndName;
    }

    @Override
    public Integer deleteByCId(Long id) {
        return courseMapper.deleteById(id);
    }
}
